package com.powerwyx.shortlink.project.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.powerwyx.shortlink.project.pojo.dto.ShortLinkBatchCreateDTO;
import com.powerwyx.shortlink.project.pojo.dto.ShortLinkCreateDTO;
import com.powerwyx.shortlink.project.pojo.dto.ShortLinkPageDTO;
import com.powerwyx.shortlink.project.pojo.dto.ShortLinkUpdateDTO;
import com.powerwyx.shortlink.project.pojo.entity.Link;
import com.powerwyx.shortlink.project.pojo.vo.ShortLinkBatchCreateVO;
import com.powerwyx.shortlink.project.pojo.vo.ShortLinkCountVO;
import com.powerwyx.shortlink.project.pojo.vo.ShortLinkCreateVO;
import com.powerwyx.shortlink.project.pojo.vo.ShortLinkPageVO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;

/**
* @author 17585
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-07-05 21:26:37
*/
public interface LinkService extends IService<Link> {

    /**
     * 创建短链接
     * @param shortLinkCreateDTO
     * @return
     */
    ShortLinkCreateVO createShortLink(ShortLinkCreateDTO shortLinkCreateDTO);

    /**
     * 根据分组进行分页查询短链接
     * @param shortLinkPageDTO
     * @return
     */
    IPage<ShortLinkPageVO> shortLinkPage(ShortLinkPageDTO shortLinkPageDTO);

    /**
     * 查询分组内短链接数量
     * @param gids
     * @return
     */
    List<ShortLinkCountVO> getGroupShortLinkCount(List<String> gids);

    /**
     * 修改短链接信息
     * @param shortLinkUpdateDTO
     */
    void updateShortLink(ShortLinkUpdateDTO shortLinkUpdateDTO);

    /**
     * 短链接跳转
     * @param shortUri
     * @param request
     * @param response
     */
    void restoreUrl(String shortUri, HttpServletRequest request, HttpServletResponse response);


    void shortLinkStatistics(String fullShortUrl, HttpServletRequest request, HttpServletResponse response);

    /**
     * 批量创建短链接
     * @param requestParam
     * @return
     */
    ShortLinkBatchCreateVO batchCreateShortLink(ShortLinkBatchCreateDTO requestParam);


}
